<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>调整票款编辑editTZPK </title>
	</head>
	<link rel="stylesheet" href="../css/common.css" />
	<style>
		#main{
			width:340px;
			height:150px;
			text-align:right;
		}
		#main p:nth-of-type(1){
			margin-top:30px;
		}
		#main input[type=text]{
			border:1px solid #e6e6e6;
			border-radius:2px;
			width:200px;
			height:24px;
			margin-top:10px;
			outline:none;
			margin-left:5px;
			padding-left:5px;
		}		
		#btnBox{
			text-align:center;
			margin-top:35px;
		}
		#main>p{
			margin-top:10px;
		}
		#main>p:last-child>label{
			vertical-align:top ;
		}
		#main p input[type=radio]{
			position:relative;
			top:5px;
			margin:5px 3px 0 10px;
		}
		#main p:last-child>span{
			display:inline-block;
			width:212px;
			text-align:left;
		}		
		button{
			width:90px;
			height:28px;
			background:#00aa98;
			border:none;
			color:white;
			cursor:pointer;
			margin:0 20px;
		}
		
	</style>
	<body>
		<div id='main'>			
			<p>金额<span style="color:Red;">*</span><span><input class='amount' type='text'/></span></p>	
			<p>货币类型<span style="color:Red;">*</span><span><input class='baojia' type='text' readonly/></span></p>		
			<p><label>备注<span style="color:Red;">*</span></label><span><input type="text" class="remark"></span></p>
			<p id="channel">退款路径:<span><span><input type="radio" value="order" name="channel" checked/>订单抵充(默认)</span> <input value="account" type="radio" name="channel"/>退回账户</span></p>
		</div>		
		<div id='btnBox'>
			<button class='sure'>确定</button>
			<button class='cancle'>取消</button>
		</div>
	</body>
		<script type="text/javascript" src="../js/jquery-1.12.4.js" ></script>
		<script type="text/javascript" src="../layer-v2.4/layer/layer.js" ></script>
		<script type="text/javascript" src="../js/common.js" ></script>
		<script>
			(function(){
				var baojia = getHref().baojia;
				var status = getHref().status;
				$(".baojia").val(commomFun.toEmptyString(baojia));
				if(status=="2"||status=="3"||status=="5"){
					$("input[type=radio][value=order]").parent().hide();
					$("input[type=radio][value=account]").attr("checked",true);
				}
			})();
			$(".amount").on("change keyup",function(){
				var amount = $(this).val();
				var firstChar = amount[0];
				if(firstChar=="-"){
					$("#channel").show();
				}else{
					$("#channel").hide();
				}
			});
			$(".sure").click(function(){
				var json = {};
				json.orderId = parent.$(".orderNo").text();
				json.amount = $(".amount").val();
				json.remark = $(".remark").val();	
				if(!$("#channel").is(":hidden")){
					json.channel = $("input[type=radio][name=channel]:checked").val();
				}	
				layer.msg('提交中...', {icon: 16,shade: 0.01});
				if(json.amount==""||json.remark==""){
					layer.msg("请输入完整信息", {icon: 2,time:1000})
					return false;
				}
				$.ajax({
					type:"post",
					url:"../orderModifyPrice/create?temp="+Math.random(),
					contentType:'application/json;charset=utf-8',
					data:JSON.stringify(json),
					dataType:"json",
					async:true,
					success:function(data){
						if(data.status=="1001"){
							layer.msg('调整票款成功', {icon: 1,time:1000},function(){
								closeWin()
							});			
						}else{							
							layer.alert("调整票款失败——"+data.message);
						}
					}
				});
			})
			$(".cancle").click(function(){
				closeWin()
			})
		</script>			
</html>
